﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp10
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable test = new Hashtable();
            test.Add(001, "佩奇");
            test.Add(002, "乔治");
            test.Add(003, "小猪");
            test.Add(005, "老罗");

            Console.WriteLine("请输入身份编号:");//输入查询编号
            int id = int.Parse(Console.ReadLine());
            bool flag = test.ContainsKey(id);
            if (flag)
            {
                string name = test[id].ToString();
                Console.WriteLine("您查询的小猪猪姓名为：{0}", name);

               /* if(test.ContainsValue (test[].ToString()))
                {
                    Console.WriteLine();
                }*/
            }
            else
            {
                Console.WriteLine("sorry ，没有查询到你要找小猪猪！");
            }
            Console.WriteLine("查询的个人信息如下：");
            foreach (DictionaryEntry d in test)
            {
                int key = (int)d.Key;
                string value = d.Value.ToString();
                Console.WriteLine("身份编号：{0}，姓名：{1}",key,value);   
            }
            //Console.WriteLine("身份编号：{0}，姓名：{1}");

        }
    }
}
